package org.ksystem.practise.thread;

public class ThreadTest {

    private static class TestThread extends Thread {

        public TestThread(String threadName) {
            super(threadName);
        }

        @Override
        public void run() {
            String thName = Thread.currentThread().getName();
            System.out.printf("'%s' started. /n", thName);
            for (int i = 0; i < 10; i++) {
                System.out.println(i);
            }
            System.out.printf("'%s' ended. /n", thName);
        }
    }

    public static void main(String[] args) throws Exception {
        TestThread th = new TestThread("thread 1");
        th.start();
        th.join();
        System.out.println("'main' ended.");
    }
}